-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[이수현] 휴대폰 인증 API #4
base: main
Are you sure you want to change the base?
Conversation
|
||
/** SMS 인증 */ | ||
@Post('signin/:code') | ||
@HttpCode(HttpStatus.OK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상태 코드 반환을 HttpStatus 객체를 통해 반환할 수 있군요👍
저는 200, 400 이렇게 써서 보냈었는데.. 훨씬 명시적이라 좋습니다! 알아갑니다😄
const smsCode = await this.authRepository.findOne({ | ||
where: { phone }, | ||
}); | ||
|
||
if (!smsCode || smsCode.expires < Date.now()) { | ||
throw new UnauthorizedException( | ||
'인증 시간이 만료되었습니다. 다시 시도해 주세요.', | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smsCode 변수를 보고 인증 번호를 가져오는 줄 알았어요! 변수명이 명시적이면 좋을 것 같아요😄
if (!smsCode || smsCode.expires < Date.now())
에서 핸드폰 번호가 없을 때도 '인증 시간이 만료' 로 메세지가 날라가는데, 예외처리를 분리하면 좋겠다는 생각이 드네요!
No description provided.